<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>移入移出jq</title>
    <script src="../static/jquery-1.12.4.js"></script>
    <style>
    * {
        margin: 0;
        padding: 0;
    }

    .d {
        width: 80%;
        height: 400px;
        margin: 30px auto;
        border: 1px dotted pink;
    }
    .d2{
        width: 150px;
        height: 100px;
        background-color: chartreuse;
        display: block;
        z-index: 1;
    }
    .d3{
        width: 150px;
        height: 100px;
        background-color: aqua;

    }
    .hover{
        display: none;
    }
</style>
</head>
<body>
<div class="d">
    <div class="d1">鼠标移入移出&显示与隐藏:</div>
    <div class="d1">hover事件，1，改变class-addClass()2,show()属性方法</div>
    <div class="d2">移入移出</div>
    <div class="d3">显示&隐藏</div>
</div>
<script>
    $(".d2").hover(function () {
        $(".d3").addClass("hover")
    },function () {
        $(".d3").removeClass("hover")
    })
</script>
<script>
    $(".d2").hover(function () {
        $(".d3").show();
    },function () {
        $(".d3").hide();
    });
</script>
</body>
</html>